#ifndef __CRECTANGLE_H__
#define __CRECTANGLE_H__

#include <iostream>
#include "Circle.h"
class CRectangle;
#include "Shape.h"
#include "HandleCollisions.h"

using namespace std;

class CRectangle : public Shape
{
	int m_width, m_height;

	bool legalWidthHeight( int width, int height) const ;
public:
	void set(Point p1, int width, int height);
	void set(CRectangle& newRec);
	void set(int width, int height);
	unsigned int getWidth () const {return m_width;}
	unsigned int getHeight () const {return m_height;}
	virtual bool input();
	virtual bool draw( char frameCh, bool fill, MyScreen * scr = NULL, 
					bool split = false)  ;
	virtual bool search(const Point& p1) const ;
	void splitPoint (Point& splitPoint, bool split = false);
	virtual void handleCollision (CRectangle * rec);
	virtual void handleCollision (Shape * shape);
	virtual void handleCollision (Circle * circ);
	virtual bool checkStuck (const MyScreen & scr) const;
	bool isInBorders() const ;
	virtual bool writeToText( ofstream &file);
	virtual bool writeToBin( ofstream &file);
	virtual bool readFromText( ifstream &file);
	virtual bool readFromBin( ifstream &file);
};

#endif

